import get_break from './get_break';
export default
	function compare(obj1: { condition_group: string }, obj2: { condition_group: string }) {
	const val1 = obj1.condition_group;
	const val2 = obj2.condition_group;
	let max1;
	let max2;
	if (String(val1).indexOf('and') !== -1 || String(val1).indexOf('or') !== -1) {
		const c1 = get_break(val1);
		max1 = Math.max.apply(Math, c1);
	} else {
		max1 = val1;
	}
	if (String(val2).indexOf('and') !== -1 || String(val2).indexOf('or') !== -1) {
		const c2 = get_break(val2);
		max2 = Math.max.apply(Math, c2);
	} else {
		max2 = val2;
	}
	if (Number(max1) < Number(max2)) {
		return -1;
	} else if (Number(max1) > Number(max2)) {
		return 1;
	} else {
		return 0;
	}
}



